//
//  UserdetatilTableViewCell.m
//  CheekiOS
//
//  Created by mac on 2017/6/16.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "UserdetatilTableViewCell.h"

@implementation UserdetatilTableViewCell

+ (instancetype)cellWithTableView:(UITableView *)tableView indexPath:(NSIndexPath*)indexPath {
    static NSString *UserDetatilCellIdent = @"UserDetatilCellIdent";
    UserdetatilTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:UserDetatilCellIdent];
    if (!cell) {
        cell = [[UserdetatilTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:UserDetatilCellIdent];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;

    return cell;
    
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.imgView = [[UIImageView alloc] init];
        self.imgView.contentMode = UIViewContentModeScaleAspectFill;
        [self addSubview:self.imgView];
        
        self.nameLab = [[UILabel alloc] init];
        self.nameLab.font = FontP(15);
        self.nameLab.textColor = [UIColor blackColor];
        self.nameLab.textAlignment = NSTextAlignmentLeft;
        [self addSubview:self.nameLab];
        
        self.linLab = [[UILabel alloc] init];
        self.linLab.backgroundColor = TheLinColor;
        [self addSubview:_linLab];
        
      
    }
    return self;
}

-(void)layoutSubviews{
    [super layoutSubviews];
    
    CGFloat imgViewH ;
    
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad){
        NSLog(@"ipad");
        imgViewH = 10;
    }else{
        imgViewH = 20;
        NSLog(@"iphone or ipod");
    }
    
    self.imgView.frame = CGRectMake(15, 19, imgViewH*SCREEN_WIDTH_RATIO47, imgViewH*SCREEN_WIDTH_RATIO47);
    
    self.nameLab.frame = CGRectMake(self.imgView.right+10, 14, 150, self.height-28);
    
    self.linLab.frame = CGRectMake(self.imgView.right+10, self.height-1, self.width, 1);
}

@end
